<?php
define('DB_SERVER','localhost');
define('DB_USER','root');
define('DB_PASSWORD','amud');
define('DB_DATABASE','amud');
/**
 * DB class, make db connections.
 * @package meta
 * @author alcaitiff
 */
class DB
{
    /**
     *
     * @var mysqli
     */
	private $db=null;
	/**
     * Create a connection
     */
	public function __construct(){
		$this->db=new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_DATABASE);
		if (mysqli_connect_errno()) {
			throw new Exception('DataBase connection error');
		}
	}
	/**
     * Close the connection
     */
	function __destruct() {
    	$this->db->close();
   	}
   	
	/**
     * Magic Get
     * @param string $property
     * @return mysqli
     */
	public function __get($property){
		return $this->$property;
	}
	
}